import service from './request'

export function getCourses(params) {
    let {pagenum,pagesize,department_id}=params
    if (department_id){
        return service.get('/courses?page='+pagenum+'&page_size='+pagesize+'&school_id='+department_id)
    }
    else{
        let url = '/courses?page='+pagenum+'&page_size='+pagesize
        return service.get(url)
    }
    
}

export function createCourse(data) {
    return service.post('/courses',data)
}


export function getNoPagingCourses(queryinfo) {
    let url = queryinfo ? '/courses?queryinfo='+queryinfo :  '/courses'
    return service.get(url)
}
// 根据id获取数据
export function getCourseInfoById(id){
    return service.get('/courses/'+id)
}
// 根据id修改课程信息
export function updateCourseInfo(id,params){
    return service.put('/courses/'+id,params)
}
export function getCoursesByClassId(class_id) {
    return service.get('/courses?class_id='+class_id)
}